<?php

use App\Admin\Controllers\DepartmentCategoryController;
use App\Admin\Controllers\HomeController;
use App\Admin\Controllers\ProjectController;
use App\Admin\Controllers\ProjectHasExtraController;
use App\Admin\Controllers\ReservationLogController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix' => config('admin.route.prefix'),
    'namespace' => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', [HomeController::class, "index"]);
    $router->get('/home_setting', [HomeController::class, "setting"]);
    $router->get('/reservation-logs/timeline-view', [ReservationLogController::class, "timelineView"]);

    Route::group([
        'prefix' => 'api'
    ], function (Router $router) {
        $router->get('project/time_range', [ProjectController::class, 'getTimeRangeOption'])
            ->name('admin.api.project.time_range');
        $router->get('project/multiple_time_range', [ProjectController::class, 'getMultipleTimeRangeOption'])
            ->name('admin.api.project.multiple_time_range');

    });

    Route::group([
        'prefix' => 'settings'
    ], function (Router $router) {
        $router->get("site", [HomeController::class, 'siteSetting']);
    });

    $router->resource('reservation-logs', ReservationLogController::class);
    $router->resource('department_categories', DepartmentCategoryController::class);
    $router->resource('project-has-extra', ProjectHasExtraController::class);
    $router->resource('projects', ProjectController::class);
    $router->resource('users', \App\Admin\Controllers\UserController::class)->names("my-self-users");
});
